Skip to content

Fix suspension persistence to materialize app state before shutdown save - #4353

Merged
ChrisPulman merged 3 commits into
mainfrom
CP_fix-suspension-disposal-bug
May 7, 2026
Merged

Fix suspension persistence to materialize app state before shutdown save#4353
ChrisPulman merged 3 commits into
mainfrom
CP_fix-suspension-disposal-bug

Conversation

@ChrisPulman

@ChrisPulman ChrisPulman commented May 6, 2026

Copy link
Copy Markdown
Member

What kind of change does this PR introduce?

Fix

What is the current behavior?

Closes #4352

What is the new behavior?

Summary

  • Fixes ReactiveUI suspension persistence so ShouldPersistState now forces app state materialization before SaveState runs, covering first-launch shutdown paths and missed launch-signal ordering.
  • Adds regression tests for typed and untyped hosts that verify created state, loaded state, and persist-token disposal, including the repro ordering from issue #4352.
  • Reviewer context: this addresses the shutdown/disposal failure reproduced in JosiahDanger/SuspensionDisposalBug.

Testing

  • dotnet build src\tests\ReactiveUI.Tests\ReactiveUI.Tests.csproj --no-restore
  • Ran focused TUnit executables for SuspensionHostExtensionsTests and SuspensionHostExtensionsAotTests on net8.0, net9.0, and net10.0
  • Ran a broader SuspensionHost* sweep on net10.0; all passed

What might this PR break?

Checklist

  • I have read the Contribute guide
  • Tests have been added or updated (for bug fixes / features)
  • Docs have been added or updated (for bug fixes / features)
  • Changes target the main branch
  • PR title follows Conventional Commits

Additional information

@codecov

codecov Bot commented May 6, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 81.81818% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 89.85%. Comparing base (303d184) to head (2c292ab).

Files with missing lines Patch % Lines
.../ReactiveUI/Suspension/SuspensionHostExtensions.cs 80.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4353      +/-   ##
==========================================
- Coverage   89.86%   89.85%   -0.02%     
==========================================
  Files         253      253              
  Lines        9652     9659       +7     
  Branches     1476     1481       +5     
==========================================
+ Hits         8674     8679       +5     
  Misses        734      734              
- Partials      244      246       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@ChrisPulman
ChrisPulman marked this pull request as ready for review May 6, 2026 23:26
@ChrisPulman
ChrisPulman merged commit bd27fbc into main May 7, 2026
8 of 10 checks passed
@ChrisPulman
ChrisPulman deleted the CP_fix-suspension-disposal-bug branch May 7, 2026 06:59
@github-actions

Copy link
Copy Markdown

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators May 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: AutoSuspendHelper Disposal Causes Runtime Exception - State Fails to Persist

2 participants